package io.practice;

import java.io.*;

public class Practice03 {
    public static void main(String[] args) {
        try(Reader reader = new FileReader("./test.txt");
            Writer writer = new FileWriter("test2.txt")){
//            while(true){
//                int ch = reader.read();
//                if(ch == -1){
//                    break;
//                }
//                System.out.print((char)ch);
//            }
//            System.out.println();
            char[] chars = new char[1024];
            System.out.println(chars.length);
            while (true){
                int n = reader.read(chars);
                if(n == -1){
                    break;
                }
                writer.write(chars, 0, n);
                for(int i = 0; i < n; i++){
                    System.out.print(chars[i]);
                }
            }
            System.out.println();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
